package model;

import java.util.HashMap;
import java.util.Observable;

public class Memory implements FunctionalUnit {
	
	private Pipe destinationPipe;
	private Pipe sourcePipe;
	private HashMap<Integer, Integer> content = new HashMap<Integer, Integer>();
	
	public void setData (int address, int data) {
		content.put(address,data);
	}
	
	public void execute(){
		int base = sourcePipe.getData("BASE");
		destinationPipe.setData("BASE", content.get(base));	
	}
	
	public void update(Observable o, Object arg) {
		execute();
	}

}
